"""
Case Type   : gs_checkse工具功能
Case Name   : 验证打印帮助信息gs_checkse -? | --help
Create At   : 2024/10/21
Owner       : lihongji
Description :
    1.gs_checkse -?打印工具帮助信息
    2.gs_checkse -help打印工具帮助信息
Expect      :
    1.成功
    2.成功
History     :
"""
import os
import unittest

from testcase.utils.Logger import Logger
from yat.test import Node
from yat.test import macro

class ParallelEnable(unittest.TestCase):
    def setUp(self):
        self.log = Logger()
        self.log.info(f'----{os.path.basename(__file__)} start----')
        self.primary = Node('PrimaryDbUser')
        self.env_path = macro.DB_ENV_PATH

    def test_paralle(self):
        step = '----step1:gs_checkse -?打印工具帮助信息 expect:成功----'
        self.log.info(step)
        gs_checkse_helpInfo = self.primary.sh(f'source {self.env_path};'
                                              f'gs_checkse -?').result()
        self.log.info(gs_checkse_helpInfo)
        self.assertIn("Item number description",
                      gs_checkse_helpInfo, '执行失败' + step)
        self.assertIn("General options", gs_checkse_helpInfo, '执行失败' + step)
        self.assertIn("Usage", gs_checkse_helpInfo, '执行失败' + step)

        step = '----step2:gs_checkse --help打印工具帮助信息 expect:成功----'
        self.log.info(step)
        gs_checkse_helpInfo = self.primary.sh(f'source {self.env_path};'
                                              f'gs_checkse --help').result()
        self.log.info(gs_checkse_helpInfo)
        self.assertIn("Item number description",
                      gs_checkse_helpInfo, '执行失败' + step)
        self.assertIn("General options", gs_checkse_helpInfo, '执行失败' + step)
        self.assertIn("Usage", gs_checkse_helpInfo, '执行失败' + step)

    def tearDown(self):
        self.log.info('----无需清理环境----')
        self.log.info(f'----{os.path.basename(__file__)} end----')
